package com.showcai.wap.user;


import com.showcai.module.vo.User;
import com.showcai.webcore.controller.base.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by Baggio on 2018-6-22.
 */
@Controller
@RequestMapping("user")
public class UserController extends BaseController {
    @RequestMapping("/getUser")
    @ResponseBody
    public User getUser() {
        User user = new User();
        user.setNickName("小明");
        user.setPassWord("xxxx");
        return user;
    }

    @RequestMapping("/user")
    public ModelAndView user() {
        System.out.println("user===================>>>>");
        ModelAndView mov = new ModelAndView();
        mov.setViewName("/index.html");
        User user = new User();
        user.setNickName("小明");
        user.setPassWord("xxxx");
        mov.addObject("user", user);
        mov.addObject("title","欢迎使用Thymeleaf!");
        return mov;
    }
    @RequestMapping(value = "/greeting")
    public ModelAndView test(ModelAndView mv) {
        mv.setViewName("/greeting.html");
        mv.addObject("title","欢迎使用Thymeleaf!");
        return mv;
    }

}
